﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JModel;

public partial class aspnet_testPargrameDir_site_Member_Admin_stud : System.Web.UI.Page
{


    protected void Page_Load(object sender, EventArgs e)
    {

    }
    /// <summary>
    /// 创建会员
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void LinkButton2_Click(object sender, EventArgs e)
    {


        LinkButton linkBtn = ((LinkButton)sender);
        string stidstr = linkBtn.CommandArgument.ToString();
        int stid = 0;
        int.TryParse(stidstr, out stid);

        /// <summary>
        /// 数据操作
        /// </summary>
        DBEntities db = new DBEntities();
        if (db.RegUser.Where(p => p.RegUser_LX == stid).Count() == 0)
        {
            db.RegUser.AddObject(new RegUser()
            {
                RegUser_LX = stid,
                RegUser_Contont = string.Empty,
                RegUser_Name = string.Empty,
                RegUser_PublicTime = DateTime.Now,
                RegUser_Pic = string.Empty,
                RegUser_Link = string.Empty,
                RegUser_Explier = string.Empty,
                RegUser_CreatefileName ="12346",
            });
            db.SaveChanges();

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), stidstr, "<script>alert('成功创建会员号为" + stidstr + "的会员!') </script>", false);

        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), stidstr, "<script>alert('会员号为" + stidstr + "的会员 .已经存在,重新创建失败!') </script>", false);
        }
        db.Connection.Close();
        db.Dispose();

    }
}